<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of WorkflowNodeAction
 *
 * @author 志鹏
 */
class WorkflowNodeAction extends CommonAction {
    
    private $theTypes = array(
        "1" => "人为决策",
        "2" => "自动处理",
        "3" => "等待外部相应",
        "4" => "分支",
        "5" => "汇合",
        "6" => "结束节点",
        "7" => "条件判断"
    );
    
    public function index() {
        $workflow_id = abs(intval($_GET["workflow_id"]));
        if(!$workflow_id) {
            $this->redirect("/HOME/Workflow");
        }
        $workflow = D("Workflow");
        $theWorkflow = $workflow->find($workflow_id);
        if(!$theWorkflow) {
            $this->redirect("/HOME/Workflow");
        }
        $this->assign("theWorkflow", $theWorkflow);
        $_REQUEST["order"] = "listorder";
        $_REQUEST["sort"] = "ASC";
        parent::index();
    }
    
    public function _before_edit() {
        $this->assign("theTypes", $this->theTypes);
    }
    
    public function add() {
        $this->assign("theTypes", $this->theTypes);
        $workflow_id = abs(intval($_GET["workflow_id"]));
        if(!$workflow_id) {
            $this->redirect("/HOME/Workflow");
        }
        $workflow = D("Workflow");
        $theWorkflow = $workflow->find($workflow_id);
        $this->assign("theWorkflow", $theWorkflow);
        
        parent::add();
    }
    
}

?>
